package com.insigma.business.qrcode.welfare.controller;

import com.insigma.business.qrcode.common.template.BasePagingResponse;
import com.insigma.business.qrcode.common.vo.BaseDeleteRequest;
import com.insigma.business.qrcode.common.vo.BaseResponse;
import com.insigma.business.qrcode.soldier.request.BaseGetRequest;
import com.insigma.business.qrcode.welfare.dto.CareWelfareServiceOrganizationDTO;
import com.insigma.business.qrcode.welfare.request.CareWelfareServiceOrganizationInsertRequest;
import com.insigma.business.qrcode.welfare.request.CareWelfareServiceOrganizationSearchRequest;
import com.insigma.business.qrcode.welfare._bff.CareWelfareServiceOrganizationBFFProvider;
import com.insigma.business.qrcode.welfare.request.CareWelfareServiceOrganizationUpdateRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api("码上医疗/游园")
@RestController
@RequestMapping("/careWelfareOragiza")
public class CareWelfareOrganizaController {


    @Resource
    CareWelfareServiceOrganizationBFFProvider careWelfareServiceOrganizationBFFProvider;

    @ApiOperation("查询医院/景区列表")
    @PostMapping("/orgSearch")
    public BasePagingResponse<List<CareWelfareServiceOrganizationDTO>> searchCareWelfareMerchantInfo(@RequestBody CareWelfareServiceOrganizationSearchRequest careWelfareMerchantInfoSearchRequest){
        return careWelfareServiceOrganizationBFFProvider.searchCareWelfareServiceOrganization(careWelfareMerchantInfoSearchRequest);
    }

    @ApiOperation("医院/景区详情")
    @PostMapping("/getView")
    public BaseResponse<CareWelfareServiceOrganizationDTO> getView(@RequestBody BaseGetRequest baseGetRequest){
        return careWelfareServiceOrganizationBFFProvider.getCareWelfareServiceOrganization(baseGetRequest);
    }

    @ApiOperation("查询医院/景区列表 -后管")
    @PostMapping("/orgSearchForMgt")
    public BasePagingResponse<List<CareWelfareServiceOrganizationDTO>> orgSearchForMgt(@RequestBody CareWelfareServiceOrganizationSearchRequest careWelfareMerchantInfoSearchRequest){
        careWelfareMerchantInfoSearchRequest.setOrderColumn("modify_datetime");
        return careWelfareServiceOrganizationBFFProvider.searchCareWelfareServiceOrganization(careWelfareMerchantInfoSearchRequest);
    }

    /**
     * 插入数据
     *
     * @param careWelfareServiceOrganizationInsertRequest
     * @return
     */
    @ApiOperation("新增景区信息")
    @PostMapping("/add")
    public BaseResponse<String> insertCareWelfareServiceOrganization(@RequestBody CareWelfareServiceOrganizationInsertRequest careWelfareServiceOrganizationInsertRequest){
        return careWelfareServiceOrganizationBFFProvider.insertCareWelfareServiceOrganization(careWelfareServiceOrganizationInsertRequest);
    }

    /**
     * 更新数据
     *
     * @param careWelfareServiceOrganizationUpdateRequest
     * @return
     */
    @ApiOperation("更新景区信息")
    @PostMapping("/update")
    public BaseResponse<Integer> updateCareWelfareServiceOrganization(@RequestBody CareWelfareServiceOrganizationUpdateRequest careWelfareServiceOrganizationUpdateRequest){
        return careWelfareServiceOrganizationBFFProvider.updateCareWelfareServiceOrganization(careWelfareServiceOrganizationUpdateRequest);
    }

    /**
     * 删除数据
     *
     * @param deleteRequest
     * @return
     */
    @ApiOperation("删除景区信息")
    @PostMapping("/delete")
    public BaseResponse<Integer> deleteCareWelfareServiceOrganization(@RequestBody BaseDeleteRequest deleteRequest){
        return careWelfareServiceOrganizationBFFProvider.deleteCareWelfareServiceOrganization(deleteRequest);
    }

    /**
     * 发布和取消发布
     * @param request
     * @return
     */
    @ApiOperation("发布和取消发布")
    @PostMapping("/publishOrg")
    public BaseResponse<Integer> publishOrg(@RequestBody CareWelfareServiceOrganizationUpdateRequest request){
        return careWelfareServiceOrganizationBFFProvider.publishOrg(request);
    }

}
